package com.rtf.framework.monitor.config;

import com.google.common.collect.Lists;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;

import java.util.List;

@Getter
@Setter
@ConfigurationProperties(prefix = "app.monitor")
public class AppMonitorProperties implements EnvironmentAware {

    // 应用名称
    public static String appName = "" ;

    // 监控类型，默认包括jvm、hystrix、ribbon、url请求
    private List<String> metrics  = Lists.newArrayList() ;

    /**
     * 获取应用名称
     * @return
     */
    public static String getAppName(){
        return appName ;
    }

    @Override
    public void setEnvironment(Environment environment) {
        appName = environment.getProperty("spring.application.name" , "") ;
    }

}
